/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;
import javax.swing.Box;
import mail.Mail;
import mail.mailbox;
/**
 *
 * @author BlueMoon
 */
public class MainFrame extends javax.swing.JFrame {

    
    mailbox box;
    /**
     * Creates new form MainFrame
     */
    public MainFrame() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        LOGIN_LAYER = new javax.swing.JLayeredPane();
        Label1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        PasswordField = new javax.swing.JPasswordField();
        AddressField = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        MENU_LAYER = new javax.swing.JLayeredPane();
        Label6 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jButton14 = new javax.swing.JButton();
        jButton15 = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jButton7 = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        SEND_LAYER = new javax.swing.JLayeredPane();
        Label3 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextPane1 = new javax.swing.JTextPane();
        jButton18 = new javax.swing.JButton();
        jButton19 = new javax.swing.JButton();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jButton10 = new javax.swing.JButton();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        RECEIVE_BOX_LAYER = new javax.swing.JLayeredPane();
        Label4 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jButton8 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jButton12 = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextPane2 = new javax.swing.JTextPane();
        jLabel28 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(204, 204, 204));
        setPreferredSize(new java.awt.Dimension(800, 600));
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
        });
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        LOGIN_LAYER.setBackground(new java.awt.Color(204, 204, 204));

        Label1.setBackground(new java.awt.Color(255, 255, 255));
        Label1.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N
        Label1.setText("simonmail  by Simon");
        Label1.setBounds(40, 20, 340, 40);
        LOGIN_LAYER.add(Label1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/1.gif"))); // NOI18N
        jLabel2.setBounds(400, 10, 50, 50);
        LOGIN_LAYER.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
        PasswordField.setBounds(120, 210, 250, 40);
        LOGIN_LAYER.add(PasswordField, javax.swing.JLayeredPane.DEFAULT_LAYER);
        AddressField.setBounds(120, 160, 250, 40);
        LOGIN_LAYER.add(AddressField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setFont(new java.awt.Font("宋体", 0, 18)); // NOI18N
        jLabel1.setText("邮箱地址:");
        jLabel1.setBounds(29, 160, 81, 40);
        LOGIN_LAYER.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setFont(new java.awt.Font("宋体", 0, 18)); // NOI18N
        jLabel3.setText("密码:");
        jLabel3.setBounds(60, 210, 50, 40);
        LOGIN_LAYER.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton1.setText("登陆");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jButton1.setBounds(290, 280, 80, 40);
        LOGIN_LAYER.add(jButton1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setText("登陆中...");
        jLabel4.setBounds(210, 280, 60, 40);
        LOGIN_LAYER.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setText("登陆失败,用户名或密码错误");
        jLabel5.setBounds(120, 280, 160, 30);
        LOGIN_LAYER.add(jLabel5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/2.gif"))); // NOI18N
        jLabel7.setBounds(400, 10, 50, 50);
        LOGIN_LAYER.add(jLabel7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel13.setText("suggest: qq.com  sjtu.edu.cn");
        jLabel13.setBounds(390, 160, 190, 30);
        LOGIN_LAYER.add(jLabel13, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Label6.setBackground(new java.awt.Color(255, 255, 255));
        Label6.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N
        Label6.setText("simonmail  by Simon");
        Label6.setBounds(40, 20, 340, 40);
        MENU_LAYER.add(Label6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/3.gif"))); // NOI18N
        jLabel11.setBounds(400, 10, 50, 50);
        MENU_LAYER.add(jLabel11, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton14.setText("收件箱");
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });
        jButton14.setBounds(40, 140, 80, 23);
        MENU_LAYER.add(jButton14, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton15.setText("发送邮件");
        jButton15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton15ActionPerformed(evt);
            }
        });
        jButton15.setBounds(40, 100, 81, 23);
        MENU_LAYER.add(jButton15, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel16.setFont(new java.awt.Font("幼圆", 1, 18)); // NOI18N
        jLabel16.setText("***的邮箱");
        jLabel16.setBounds(160, 90, 580, 60);
        MENU_LAYER.add(jLabel16, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton2.setText("登出");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jButton2.setBounds(40, 250, 80, 23);
        MENU_LAYER.add(jButton2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel6.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(153, 153, 255));
        jLabel6.setText("You belong with me, not swallowed in the sea.    ----coldplay");
        jLabel6.setBounds(160, 150, 550, 40);
        MENU_LAYER.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton7.setText("重新登录");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });
        jButton7.setBounds(40, 280, 81, 23);
        MENU_LAYER.add(jButton7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel10.setText("登录成功");
        jLabel10.setBounds(50, 310, 60, 20);
        MENU_LAYER.add(jLabel10, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel14.setText("登录失败");
        jLabel14.setBounds(50, 310, 70, 20);
        MENU_LAYER.add(jLabel14, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Label3.setBackground(new java.awt.Color(255, 255, 255));
        Label3.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N
        Label3.setText("simonmail  by Simon");
        Label3.setBounds(40, 20, 340, 40);
        SEND_LAYER.add(Label3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/3.gif"))); // NOI18N
        jLabel8.setBounds(400, 10, 50, 50);
        SEND_LAYER.add(jLabel8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton5.setText("收件箱");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        jButton5.setBounds(40, 140, 80, 23);
        SEND_LAYER.add(jButton5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton6.setText("发送邮件");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });
        jButton6.setBounds(40, 100, 81, 23);
        SEND_LAYER.add(jButton6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel12.setText("正文");
        jLabel12.setBounds(150, 160, 30, 20);
        SEND_LAYER.add(jLabel12, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton3.setText("登出");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jButton3.setBounds(40, 250, 80, 23);
        SEND_LAYER.add(jButton3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel15.setText("收件人");
        jLabel15.setBounds(140, 80, 40, 20);
        SEND_LAYER.add(jLabel15, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel17.setText("主题");
        jLabel17.setBounds(150, 120, 30, 20);
        SEND_LAYER.add(jLabel17, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jTextField2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField2MouseClicked(evt);
            }
        });
        jTextField2.setBounds(180, 80, 580, 30);
        SEND_LAYER.add(jTextField2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jTextField3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField3MouseClicked(evt);
            }
        });
        jTextField3.setBounds(180, 120, 580, 30);
        SEND_LAYER.add(jTextField3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jTextPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextPane1MouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jTextPane1);

        jScrollPane1.setBounds(180, 160, 580, 340);
        SEND_LAYER.add(jScrollPane1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton18.setText("发送");
        jButton18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton18ActionPerformed(evt);
            }
        });
        jButton18.setBounds(180, 520, 57, 23);
        SEND_LAYER.add(jButton18, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton19.setText("清空");
        jButton19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton19ActionPerformed(evt);
            }
        });
        jButton19.setBounds(670, 520, 87, 23);
        SEND_LAYER.add(jButton19, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel18.setText("发送中...");
        jLabel18.setBounds(250, 520, 90, 20);
        SEND_LAYER.add(jLabel18, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel19.setText("发送失败!!");
        jLabel19.setBounds(250, 520, 90, 20);
        SEND_LAYER.add(jLabel19, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel20.setText("发送成功!!");
        jLabel20.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel20MouseClicked(evt);
            }
        });
        jLabel20.setBounds(250, 520, 80, 20);
        SEND_LAYER.add(jLabel20, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton10.setText("重新登录");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });
        jButton10.setBounds(40, 280, 81, 23);
        SEND_LAYER.add(jButton10, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel21.setText("登录成功");
        jLabel21.setBounds(50, 310, 60, 20);
        SEND_LAYER.add(jLabel21, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel22.setText("登录失败");
        jLabel22.setBounds(50, 310, 70, 20);
        SEND_LAYER.add(jLabel22, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Label4.setBackground(new java.awt.Color(255, 255, 255));
        Label4.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N
        Label4.setText("simonmail  by Simon");
        Label4.setBounds(40, 20, 340, 40);
        RECEIVE_BOX_LAYER.add(Label4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/3.gif"))); // NOI18N
        jLabel9.setBounds(400, 10, 50, 50);
        RECEIVE_BOX_LAYER.add(jLabel9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton8.setText("收件箱");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });
        jButton8.setBounds(40, 140, 80, 23);
        RECEIVE_BOX_LAYER.add(jButton8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton9.setText("发送邮件");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });
        jButton9.setBounds(40, 100, 81, 23);
        RECEIVE_BOX_LAYER.add(jButton9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton4.setText("登出");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        jButton4.setBounds(40, 250, 80, 23);
        RECEIVE_BOX_LAYER.add(jButton4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton11.setText("重新登录");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });
        jButton11.setBounds(40, 280, 81, 23);
        RECEIVE_BOX_LAYER.add(jButton11, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel23.setText("登录成功");
        jLabel23.setBounds(50, 310, 60, 20);
        RECEIVE_BOX_LAYER.add(jLabel23, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel24.setText("登录失败");
        jLabel24.setBounds(50, 310, 70, 20);
        RECEIVE_BOX_LAYER.add(jLabel24, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel25.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N
        jLabel25.setText("共有x封邮件");
        jLabel25.setBounds(160, 90, 100, 30);
        RECEIVE_BOX_LAYER.add(jLabel25, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel26.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N
        jLabel26.setText("打开第");
        jLabel26.setBounds(260, 90, 50, 30);
        RECEIVE_BOX_LAYER.add(jLabel26, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jTextField1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField1MouseClicked(evt);
            }
        });
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });
        jTextField1.setBounds(310, 90, 50, 30);
        RECEIVE_BOX_LAYER.add(jTextField1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton12.setText("打开");
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });
        jButton12.setBounds(380, 90, 57, 30);
        RECEIVE_BOX_LAYER.add(jButton12, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel27.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N
        jLabel27.setText("封");
        jLabel27.setBounds(360, 90, 20, 30);
        RECEIVE_BOX_LAYER.add(jLabel27, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jTextPane2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextPane2MouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(jTextPane2);

        jScrollPane3.setBounds(160, 140, 600, 400);
        RECEIVE_BOX_LAYER.add(jScrollPane3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel28.setText("打开失败");
        jLabel28.setBounds(460, 90, 60, 30);
        RECEIVE_BOX_LAYER.add(jLabel28, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 820, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(LOGIN_LAYER, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 800, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(SEND_LAYER, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 800, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(MENU_LAYER, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 800, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(RECEIVE_BOX_LAYER, javax.swing.GroupLayout.PREFERRED_SIZE, 800, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1226, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(LOGIN_LAYER, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(SEND_LAYER, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(MENU_LAYER, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(616, Short.MAX_VALUE)
                    .addComponent(RECEIVE_BOX_LAYER, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        jLabel5.setVisible(false);
        jLabel10.setVisible(false);
        jLabel14.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        jLabel28.setVisible(false);
        jLabel4.setVisible(true);
        Mail.mailAddress = AddressField.getText();
        Mail.password = PasswordField.getText();
        System.out.println(Mail.mailAddress);
        System.out.println(Mail.password);
        Boolean loginOK = Mail.LoginOK();
        if (loginOK)
        {
            MENU_LAYER.setVisible(true);
            LOGIN_LAYER.setVisible(false);
            jLabel16.setText(Mail.mailAddress+"的邮箱");
            jLabel4.setVisible(false);
            PasswordField.setText("");
            box = new mailbox();
            jLabel25.setText("共有"+ box.number + "封邮件");
        }
        else
        {
            //AddressField.setText("");
            jLabel2.setVisible(false);
            jLabel4.setVisible(false);
            PasswordField.setText("");
            jLabel5.setVisible(true);
            jLabel7.setVisible(true);
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowActivated

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(false);
        //SEND_BOX_LAYER.setVisible(false);
        box.renew();
        jLabel25.setText("共有"+ box.number + "封邮件");
        RECEIVE_BOX_LAYER.setVisible(true);
        jLabel20.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(false);
        //SEND_BOX_LAYER.setVisible(false);
        box.renew();
        jLabel25.setText("共有"+ box.number + "封邮件");
        RECEIVE_BOX_LAYER.setVisible(true);
        jLabel28.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);     
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton8ActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        jLabel4.setVisible(false); 
        jLabel7.setVisible(false);
        jLabel5.setVisible(false);
        jLabel18.setVisible(false);
        jLabel19.setVisible(false);
        jLabel20.setVisible(false);
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(false);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(false);  
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowOpened

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(true);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(false);
        jLabel20.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(true);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(false);
        jLabel28.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(false);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(true);
        box.renew();
        jLabel25.setText("共有"+ box.number + "封邮件");
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton14ActionPerformed

    private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(true);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton15ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        Mail.Logout();
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(false);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(false);
        LOGIN_LAYER.setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        Mail.Logout();
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(false);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(false);
        LOGIN_LAYER.setVisible(true);
        jLabel20.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        Mail.Logout();
        MENU_LAYER.setVisible(false);
        SEND_LAYER.setVisible(false);
        //SEND_BOX_LAYER.setVisible(false);
        RECEIVE_BOX_LAYER.setVisible(false);
        LOGIN_LAYER.setVisible(true);
        jLabel28.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
        jTextPane1.setText("");
        jLabel19.setVisible(false);
        jLabel20.setVisible(false);
        jLabel20.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton19ActionPerformed

    private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
        jLabel18.setVisible(true);
        jLabel19.setVisible(false);
        Mail.sendAddress = jTextField2.getText();
        Mail.sendTheme = jTextField3.getText();
        Mail.sendBody = jTextPane1.getText();
        Boolean sendOK = Mail.SendMail(Mail.sendAddress, Mail.sendTheme, Mail.sendBody);
        if (sendOK)
        {
            jLabel18.setVisible(false);
            jTextPane1.setText("");
            jTextField2.setText("");
            jTextField3.setText("");
            jLabel20.setVisible(true);
        }
        else
        {
            jLabel18.setVisible(false);
            jLabel19.setVisible(true);
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton18ActionPerformed

    private void jLabel20MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel20MouseClicked
        jLabel20.setVisible(false);
        jLabel10.setVisible(false);
        jLabel14.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel20MouseClicked

    private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
        jLabel20.setVisible(false);
        jLabel10.setVisible(false);
        jLabel14.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        jLabel28.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_formMouseClicked

    private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseClicked
        jLabel20.setVisible(false);
        jLabel10.setVisible(false);
        jLabel14.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField2MouseClicked

    private void jTextField3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField3MouseClicked
        jLabel20.setVisible(false);
        jLabel10.setVisible(false);
        jLabel14.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField3MouseClicked

    private void jTextPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextPane1MouseClicked
        jLabel20.setVisible(false);
        jLabel10.setVisible(false);
        jLabel14.setVisible(false);
        jLabel21.setVisible(false);
        jLabel22.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextPane1MouseClicked

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        Boolean loginOK = Mail.LoginOK();
        if (loginOK)
        {
            jLabel10.setVisible(true);
        }
        else
        {
            jLabel4.setVisible(true);
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        Boolean loginOK = Mail.LoginOK();
        if (loginOK)
        {
            jLabel21.setVisible(true);
        }
        else
        {
            jLabel22.setVisible(true);
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton10ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        jLabel28.setVisible(false);
        Boolean loginOK = Mail.LoginOK();
        if (loginOK)
        {
            jLabel23.setVisible(true);
        }
        else
        {
            jLabel24.setVisible(true);
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton11ActionPerformed

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
        jLabel28.setVisible(false);
        String tmp = box.open(Integer.parseInt(jTextField1.getText()));
        if (tmp == null)
        {
            jLabel28.setVisible(true);
            jTextPane2.setText("");
        }
        else
        {
            jTextPane2.setText(tmp);
        }
    }//GEN-LAST:event_jButton12ActionPerformed

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1ActionPerformed

    private void jTextPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextPane2MouseClicked
        jLabel28.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextPane2MouseClicked

    private void jTextField1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField1MouseClicked
        jLabel28.setVisible(false);
        jLabel23.setVisible(false);
        jLabel24.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1MouseClicked

    /**
     * @param args the command line arguments
     */
    public static void start() {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField AddressField;
    private javax.swing.JLayeredPane LOGIN_LAYER;
    private javax.swing.JLabel Label1;
    private javax.swing.JLabel Label3;
    private javax.swing.JLabel Label4;
    private javax.swing.JLabel Label6;
    private javax.swing.JLayeredPane MENU_LAYER;
    private javax.swing.JPasswordField PasswordField;
    private javax.swing.JLayeredPane RECEIVE_BOX_LAYER;
    private javax.swing.JLayeredPane SEND_LAYER;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton18;
    private javax.swing.JButton jButton19;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextPane jTextPane1;
    private javax.swing.JTextPane jTextPane2;
    // End of variables declaration//GEN-END:variables
}
